<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-bind</title>
  <script src="../assets/js/vue.js"></script>
</head>

<body>
  <h1>v-bind</h1>
  <hr>
  <div id="app">
    <p>
      <img v-bind:src="imgSrc" alt="">
    </p>
    <p>
      <a :href="aurl" target="_blank">百度</a>
      <!-- v-bind简写 : -->
    </p>
    <hr>
    <div :class="className">1、绑定class</div>
    <div :class="{classA:isOk}">2、绑定class中的判断</div>
    <div :class="[classA,classB]">3、绑定class中的数组</div>
    <div :class="isOk?classA:classB">4、绑定class中的三元运算符</div>
    <hr>
    <div>
      <input type="checkbox" id="isOk" v-model="isOk">
      <label for="isOk">isOk={{isOk}}</label>
    </div>
    <hr>
    <div :style="{color:red,fontSize:font}">5、绑定style</div>
    <div :style="styleObject">6、对象绑定到style</div>
  </div>
  <style>
    .classA {
      color: #ff0000;
    }

    .classB {
      font-size: 150%;
    }
  </style>
  <script type="text/javascript">
    var app = new Vue({
      el: '#app',
      data: {
        imgSrc: 'http://jspang.com/wp-content/uploads/2018/01/VUE-timeline.jpg',
        aurl: 'https://www.baidu.com',
        className: 'classB',
        isOk: true,
        classA: 'classA',
        classB: 'classB',
        red: 'red',
        font: '20px',
        styleObject:{
          color:'green',
          fontSize:'24px'
        }
      }
    })
  </script>
</body>

</html>